package edu.uoc.tdp.pac4.connexiomanteniment.gui;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;

import edu.uoc.tdp.pac4.common.EOlympicsException;
import edu.uoc.tdp.pac4.connexiomanteniment.i18n.*;
import edu.uoc.tdp.pac4.proves.gui.PantallaCierreInscripciones;
import edu.uoc.tdp.pac4.proves.gui.PantallaCierrePruebas;
import edu.uoc.tdp.pac4.proves.gui.PantallaPruebas;

public class PantallaMenuResponsable extends JFrame {

	private static final long serialVersionUID = 3065279689452874985L;
	
	private JPanel contentPane;
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					PantallaMenuEstudiant frame = new PantallaMenuEstudiant();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public PantallaMenuResponsable() {
		setResizable(false);
		LanguageUtils.setDefaultLanguage("i18n/messagesConnexioManteniment");
		
		setTitle(LanguageUtils.getMessage("PantallaMenuGeneral.mainmenuTitle.text"));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 439, 419);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		
		
		JPanel panel = new JPanel();
		panel.setLayout(null);
		panel.setBackground(Color.WHITE);
		panel.setBounds(0, 0, 433, 76);
		contentPane.add(panel);
		
		JLabel label_1 = new JLabel("");
		label_1.setIcon(new ImageIcon(PantallaMenuGeneral.class.getResource("/images/logo.png")));
		label_1.setBounds(6, 6, 102, 64);
		panel.add(label_1);

		JLabel label_2 = new JLabel("eOlympics");
		label_2.setForeground(new Color(51, 153, 255));
		label_2.setFont(new Font("Calibri", Font.BOLD, 26));
		label_2.setBounds(120, 28, 118, 26);
		panel.add(label_2);

		
		JLabel label_3 = new JLabel("by SoftWebSolutions");
		label_3.setFont(new Font("Calibri", Font.PLAIN, 9));
		label_3.setBounds(42, 366, 84, 14);
		contentPane.add(label_3);
		
		JLabel label_4 = new JLabel("");
		label_4.setIcon(new ImageIcon(PantallaMenuGeneral.class.getResource("/images/logo_empresa.png")));
		label_4.setBounds(10, 366, 27, 14);
		contentPane.add(label_4);
		JButton button_1 = new JButton(LanguageUtils.getMessage("PantallaMenuResponsable.testsmanagementButton.text"));
		button_1.setBounds(75, 102, 277, 47);
		getContentPane().add(button_1);
		button_1.setIcon(new ImageIcon(PantallaMenuResponsable.class.getResource("/images/users2.png")));
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {	
				PantallaPruebas frame;
				try {
					
					frame = new PantallaPruebas();
					frame.setVisible(true);
					
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (InstantiationException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (UnsupportedLookAndFeelException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (EOlympicsException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});

		JButton button_2 = new JButton(LanguageUtils.getMessage("PantallaMenuResponsable.statisticsButton.text"));
		button_2.setBounds(75, 273, 277, 47);
		getContentPane().add(button_2);
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {	
				// AQUI S'HA D'AFEGIR EL QUE CALGUI PER A OBRIR LA FINESTRA QUE TOQUI DEL SUBSISTEMA ESTADITIQUES (per a les estadistiques del gestor de proves)
			}
		});
		button_2.setIcon(new ImageIcon(PantallaMenuResponsable.class.getResource("/images/document_chart.png")));	
		
		JButton button = new JButton(LanguageUtils.getMessage("PantallaMenuResponsable.boton.cierrepruebas"));
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				PantallaCierrePruebas frame;
				try {
					
					frame = new PantallaCierrePruebas();
					frame.setVisible(true);
					
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (InstantiationException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (UnsupportedLookAndFeelException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (EOlympicsException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
				
			}
		});
		button.setIcon(new ImageIcon(PantallaMenuResponsable.class.getResource("/images/documents_preferences.png")));
		button.setBounds(75, 159, 277, 47);
		contentPane.add(button);
		
		JButton btnTancamentDinscripcions = new JButton("Tancament d'inscripcions");
		btnTancamentDinscripcions.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				PantallaCierreInscripciones frame;
				try {
					
					frame = new PantallaCierreInscripciones();
					frame.setVisible(true);
					
				
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (InstantiationException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (UnsupportedLookAndFeelException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
				
			}
		});
		btnTancamentDinscripcions.setIcon(new ImageIcon(PantallaMenuResponsable.class.getResource("/images/user1_preferences.png")));
		btnTancamentDinscripcions.setBounds(75, 217, 277, 47);
		contentPane.add(btnTancamentDinscripcions);

	}
}
